<template>
<!-- 确认支付 列表页 -->
    <div>
 <el-form :inline="true"  class="demo-form-inline">

                <el-form-item label="时间范围">
                    <el-date-picker v-model="stimeArry" type="daterange" placeholder="选择日期范围">
                    </el-date-picker>
                </el-form-item>              
                  <el-form-item>
                    <el-button type="primary" @click="onSubmit">查询</el-button>
                </el-form-item>
            </el-form>
        <el-table v-if="tableData3.length>0" :data="tableData3" border style="width: 100%" >
            <el-table-column type="selection" width="55">
            </el-table-column>
              <el-table-column prop="SALESDETAIL.SALESDETAIL_ID" label="投保单号" width="180">
            </el-table-column>           
            <el-table-column prop="SALESDETAIL.SALESDETAIL_SALESTIME" label="销售时间" width="180" :formatter="localDataFomatter">
            </el-table-column>
            <el-table-column prop="CUSTOM.CUSTOM_NAME" label="被保险人姓名" width="180">
            </el-table-column>
            <el-table-column prop="SALESDETAIL.PRODUCE_NAME" label="产品类型" width="200">
            </el-table-column>
            <el-table-column prop="SALESDETAIL.SALESDETAIL_OLD" label="投保年龄" width="200">
            </el-table-column>
            <el-table-column prop="SALESDETAIL.SALESDETAIL_MONEY" label="保费金额" width="200">
            </el-table-column>
            <el-table-column prop="SALESDETAIL.SALESDETAIL_ADDMONEY" label="增额保费" width="200">
            </el-table-column>

            <el-table-column label="操作" width="200" fixed="right">
                <template scope="scope">
                    <el-button type="text" size="media" @click="goCheckF(scope.row.CUSTOM_ID)">
                        <i class="el-icon-view"> 确认</i>
                    </el-button>

                </template>
            </el-table-column>

        </el-table>
        <div class="block">
           <el-pagination @current-change="handleCurrentChange" :current-page="currentPage1" :page-size="10" layout="total, prev, pager, next" :total="pagecount">
            </el-pagination>
        </div>
    </div>
</template>
<script>
import api from "@/js/api";
export default {
  data() {
    return {
      pagecount: 0,
      currentPage1: 1,
      timeArry: [],
      tableData3: [],
      stimeArry: []
    };
  },
  props: {
    id: {
      type: {
        type: String,
        default: ""
      }
    },
    type: {
      type: String,
      default: "待沟通"
    }
  },
  methods: {
    //时间过滤器
    localDataFomatter(row, column, cellValue) {
      cellValue = cellValue + "Z";
      var data = new Date(cellValue);
      var dataString =
        data.getFullYear() +
        "/" +
        ((data.getMonth() + 1)>=10?(data.getMonth() + 1):"0"+(data.getMonth() + 1)) +
        "/" +
        (data.getDate()>=10?data.getDate():"0"+data.getDate()) +
        " " +
        (data.getHours()>=10?data.getHours():"0"+data.getHours())+
        ":" +
        (data.getMinutes()>=10?data.getMinutes():"0"+ data.getMinutes());
      return dataString;
    },
    changeInformation(id) {
      this.$emit("changeInformation", id);
    },
    handleCurrentChange() {},
    onSubmit() {},
    allEnsure() {
      this.$notify({
        title: "成功",
        message: "这是一条成功的提示消息",
        type: "success"
      });
    },
    //获取数据
    getDate() {
      let that = this;
      if (this.type == "渠道确认") {
        var objOrginization = {
          type: "需结算",
          timeStart: "",
          timeEnd: ""
        };
        if (this.stimeArry.length > 0) {
          objOrginization.timeStart = new Date(
            this.stimeArry[0]
          ).toLocaleDateString();
          objOrginization.timeEnd = new Date(
            this.stimeArry[1]
          ).toLocaleDateString();
        }
        api.BrokerageList(that, objOrginization, function(msg) {
          that.tableData3 = msg.Result;
          that.pagecount = msg.ListCount;
        });
        return;
      }
    }
  },
  activated() {
    // console.log("确认" + this.type);
    this.getDate();
  }
};
</script>
